#ifndef __M_LIST_VIEW_H__
#define __M_LIST_VIEW_H__

#include "Layout.h"

// Wait for support
enum ListViewFocusPosDisplayMode
{
    TYPE_LISTVIEW_FOCUS_POS_DISPLAY_MODE_DEFAULT,         // 默认
    TYPE_LISTVIEW_FOCUS_POS_DISPLAY_MODE_CENTER,          // 动态居中
    TYPE_LISTVIEW_FOCUS_POS_DISPLAY_MODE_CENTER_ABSOLUTE, // 绝对居中
};

// Wait for support
enum ListViewChooseMode
{
    TYPE_LISTVIEW_CHOOSE_MODE_DISABLE,
    TYPE_LISTVIEW_CHOOSE_MODE_SINGLE,
    TYPE_LISTVIEW_CHOOSE_MODE_MULTI,
};

typedef View ListView;

#define ListViewSetLayoutGravity(listView, gravity) ViewSetLayoutGravity(listView, gravity)
#define ListViewGetLaoyoutGravity(listView) ViewGetLaoyoutGravity(listView)

#define ListViewSetLayoutMargin(listView, left, right, top, bottom) ViewSetLayoutMargin(listView, left, right, top, bottom)
#define ListViewGetLayoutMargin(listView, left, right, top, bottom) ViewGetLayoutMargin(listView, left, right, top, bottom)

#define ListViewSetLayoutSize(listView, layout_w, layout_h) ViewSetLayoutSize(listView, layout_w, layout_h)
#define ListViewGetLayoutSize(listView, layout_w, layout_h) ViewGetLayoutSize(listView, layout_w, layout_h)

#define ListViewSetLayoutAvailableSize(listView, available_w, available_h) ViewSetLayoutAvailableSize(listView, available_w, available_h)
#define ListViewGetLayoutAvailableSize(listView, available_w, available_h) ViewGetLayoutAvailableSize(listView, available_w, available_h)

#define ListViewSetLayoutPosition(listView, layout_x, layout_y) ViewSetLayoutPosition(listView, layout_x, layout_y)
#define ListViewGetLayoutPosition(listView, layout_x, layout_y) ViewGetLayoutPosition(listView, layout_x, layout_y)

#define ListViewSetVisibility(listView, visibility) ViewSetVisibility(listView, visibility)
#define ListViewGetVisibility(listView) ViewGetVisibility(listView)

#define ListViewSetOrientation(listView, orientation) ViewSetOrientation(listView, orientation)
#define ListViewGetOrientation(listView) ViewGetOrientation(listView)

#define ListViewSetGravity(listView, gravity) ViewSetGravity(listView, gravity)
#define ListViewGetGravity(listView) ViewGetGravity(listView)

#define ListViewSetPadding(listView, left, right, top, bottom) ViewSetPadding(listView, left, right, top, bottom)
#define ListViewGetPadding(listView, left, right, top, bottom) ViewGetPadding(listView, left, right, top, bottom)

#define ListViewSetAutoFree(listView, auto_free) ViewSetAutoFree(listView, auto_free)
#define ListViewIsAutoFree(listView) ViewIsAutoFree(listView)

#define ListViewSetFocus(view, focused) ViewSetFocus(view, focused)
#define ListViewIsFocused(view) ViewIsFocused(view)

#define ListViewSetBgColor(listView, color) ViewSetBgColor(listView, color)
#define ListViewGetBgColor(listView) ViewGetBgColor(listView)

#define ListViewSetUserData(listView, data) ViewSetUserData(listView, data)
#define ListViewGetUserData(listView) ViewGetUserData(listView)

#define ListViewGetMeasuredSize(listView, measured_w, measured_h) ViewGetMeasuredSize(listView, measured_w, measured_h)
#define ListViewGetWrapSize(listView, wrap_w, wrap_h) ViewGetWrapSize(listView, wrap_w, wrap_h)
#define ListViewGetOccupySize(listView, occupy_w, occupy_h) ViewGetOccupySize(listView, occupy_w, occupy_h)
#define ListViewGetMeasuredContentSize(listView, measured_content_w, measured_content_h) ViewGetMeasuredContentSize(listView, measured_content_w, measured_content_h)
#define ListViewGetWrapContentSize(listView, wrap_content_w, wrap_content_h) ViewGetWrapContentSize(listView, wrap_content_w, wrap_content_h)

int ListViewSetOnItemClickCallback(ListView *listView, int (*onItemClick)(ListView *listView, View *itemView, int id));         // Wait for support
int ListViewSetOnItemLongClickCallback(ListView *listView, int (*onItemLongClick)(ListView *listView, View *itemView, int id)); // Wait for support

int ListViewSetCurrentScrollCoord(ListView *listView, int y);
int ListViewGetCurrentScrollCoord(ListView *listView);

int ListViewSetTargetScrollCoord(ListView *listView, int y, int smooth);
int ListViewGetTargetScrollCoord(ListView *listView);

int ListViewSetTopPos(ListView *listView, int pos, int smooth);
int ListViewGetTopPos(ListView *listView);

int ListViewSetFocusPos(ListView *listView, int pos, int smooth);
int ListViewGetFocusPos(ListView *listView);

int ListViewSetDividerSize(ListView *listView, int size);
int ListViewGetDividerSize(ListView *listView);

int ListViewSetDividerColor(ListView *listView, uint32_t color);
uint32_t ListViewGetDividerColor(ListView *listView);

int ListViewSetCursorEnabled(ListView *listView, int enabled);
int ListViewIsCursorEnabled(ListView *listView);

int ListViewSetCursorColor(ListView *listView, uint32_t color);
uint32_t ListViewGetCursorColor(ListView *listView);

int ListViewMoveTopPos(ListView *listView, int move_type, int smooth);
int ListViewMoveFocusPos(ListView *listView, int move_type, int smooth);

View *ListViewFindItemViewByNum(ListView *listView, int n);
int ListViewRemoveItemView(ListView *listView, View *itemView);
int ListViewRemoveItemViewByNum(ListView *listView, int n);
int ListViewAddItemView(ListView *listView, View *itemView);
int ListViewEmptyItemViews(ListView *listView);

ListView *NewListView();
int ListViewInit(ListView *listView);
int ListViewDeinit(ListView *listView);
int ListViewDestroy(ListView *listView);
int ListViewMeasure(ListView *listView);
int ListViewDraw(ListView *listView);

#endif
